package com.jayqqaa12.system.controller;

import com.jayqqaa12.jbase.jfinal.ext.ctrl.JsonController;
import com.jayqqaa12.system.model.Log;
import com.jfinal.aop.Before;
import com.jfinal.ext.route.ControllerBind;
import com.jfinal.plugin.ehcache.CacheName;
import com.jfinal.plugin.ehcache.EvictInterceptor;
import com.jfinal.plugin.spring.Inject;


@CacheName(value = "/system/log")
@ControllerBind(controllerKey = "/system/log" )
public class LogCtrl extends JsonController<Log> 
{
	
	@Inject.BY_TYPE
	Log logDao;
	
//	@Before(value = { CacheInterceptor.class })
	public void getVisitCount(){
		renderGson(logDao.getVisitCount());
		
	}
	
//	public void list()
//	{
//		renderJson( logDao.listByDataGrid(getDataGrid(), getFrom(logDao.tableName)));
//	}
//	
	public void excel()
	{
//		renderExcel(logDao.list(getFrom(logDao.tableName)),"log.xls",new String[]{"uid","id", "用户","事件","来源","日期","ip"});
	
	}

	public void chart(){
		
		renderGson(logDao.chart(getFrom(null)));
	}
	
	
	
	
	@Before(value = { EvictInterceptor.class })
	public void delete()
	{
		renderJsonResult( logDao.deleteById(getPara("id")));
	}

}
